<?php
	//定义一个绝对路径
	$admin_path=str_replace('\\', '/', dirname(__FILE__));
	define('ADMIN_PATH', $admin_path);

	//导入之前的init.php
	include ADMIN_PATH.'/../init.php';
	define('ADMIN_URL', URL.'/admin');

	$allow=array('login','laction');
	//判断是否登录
	$str=trim(basename($_SERVER['SCRIPT_NAME']),'.php');

	if (!in_array($str, $allow)) 
	{
		if (empty($_SESSION['admin'])) 
		{
			header('location:'.ADMIN_URL.'/login.php');
		}
	}
?>